<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Test Input</title>
		<script src="js/common.js" type="text/javascript" language="javascript"></script>
		<script src="js/jquery.min.js" type="text/javascript" language="javascript"></script>
		<script type="text/javascript" language="javascript">
			function check()
			{
				var d=$("#date_format").val();
				var t=$("#time_format").val();
				var ns=$("#num_style").val();
				var descimalSep=ns.charAt(0);
				var thousandSep=ns.charAt(1);
				var valid=true;
				var requiredInputs = [['name','name_required'],['code','code_required']];
				var intInputs = [['int1','int1_invalid'],['int2','int2_invalid']];
				var dateInputs = [['date1','date1_invalid'],['date2','date2_invalid']];
				var timeInputs = [['time1','time1_invalid'],['time2','time2_invalid']];
				var doubleInputs = [['double1','double1_invalid'],['double2','double2_invalid']];
				if(checkRequiredInputs(requiredInputs)==false)
				{
					valid=false;
				}
				if(checkIntInputs(intInputs)==false)
				{
					valid=false;
				}
				if(checkDateInputs(dateInputs,d)==false)
				{
					valid=false;
				}
				if(checkTimeInputs(timeInputs,t)==false)
				{
					valid=false;
				}
				if(checkDoubleInputs(doubleInputs,descimalSep,thousandSep)==false)
				{
					valid=false;
				}
				return valid;
			}
			
		</script>
	</head>
	<body>
		Date Format:
		<select id="date_format" >
				<option value="dd/mm/yyyy">dd/mm/yyyy</option>
				<option value="mm/dd/yyyy">mm/dd/yyyy</option>
				<option value="dd-mm-yyyy">dd-mm-yyyy</option>
				<option value="mm-dd-yyyy">mm-dd-yyyy</option>
		</select> 
		Time Format:
		<select id="time_format" >
				<option value="hh:mm">hh:mm</option>
				<option value="mm:hh">mm:hh</option>
		</select> 
		Numeric Style:
		<select id="num_style" >
				<option value=",.">France</option>
				<option value=".,">US</option>
		</select> 
		<form action="" onsubmit="return check();">
		<table>
			<tr>
			<td>name:</td><td><input type="text" id="name"></td><td><p id="name_required" style="display: none">please input name</p></td>
			</tr>
			<tr>
			<td>code:</td><td><input type="text" id="code"></td><td><p id="code_required" style="display: none">please input code</p></td>
			</tr>
			<tr>
			<td>integer 1:</td><td><input type="text" id="int1"></td><td><p id="int1_invalid" style="display: none">invalid integer 1</p></td>
			</tr>
			<tr>
			<td>integer 2:</td><td><input type="text" id="int2"></td><td><p id="int2_invalid" style="display: none">invalid integer 2</p></td>
			</tr>
			<tr>
			<td>date1:</td><td><input type="text" id="date1" maxlength="10"></td><td><p id="date1_invalid" style="display: none">invalid date1</p></td>
			</tr>
			<tr>
			<td>date2:</td><td><input type="text" id="date2" maxlength="10"></td><td><p id="date2_invalid" style="display: none">invalid date2</p></td>
			</tr>
			<tr>
			<td>time1:</td><td><input type="text" id="time1" maxlength="5"></td><td><p id="time1_invalid" style="display: none">invalid time1</p></td>
			</tr>
			<tr>
			<td>time2:</td><td><input type="text" id="time2" maxlength="5"></td><td><p id="time2_invalid" style="display: none">invalid time2</p></td>
			</tr>
			<tr>
			<td>double1:</td><td><input type="text" id="double1" ></td><td><p id="double1_invalid" style="display: none">invalid double1</p></td>
			</tr>
			<tr>
			<td>double2:</td><td><input type="text" id="double2" ></td><td><p id="double2_invalid" style="display: none">invalid double2</p></td>
			</tr>
		</table>
		<input type="submit" value="submit">
		</form>
	</body>
</html>